// while_do_while.cpp
#include <iostream>

int main() {
    int counter = 1;

    // while 循环
    std::cout << "使用 while 循环打印1到5的数字：" << std::endl;
    while (counter <= 5) {
        std::cout << counter << " ";
        ++counter;
    }
    std::cout << std::endl;

    // 重置计数器
    counter = 1;

    // do-while 循环
    std::cout << "使用 do-while 循环打印1到5的数字：" << std::endl;
    do {
        std::cout << counter << " ";
        ++counter;
    } while (counter <= 5);

    std::cout << std::endl;

    return 0;
}